﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AbstractFactory
{
    internal abstract class Page
    {
        protected string title;
        protected string author;
        protected List<Item> content = new();
        public Page(string title, string author)
        {
            this.title = title;
            this.author = author;
        }

        public void Add(Item item)
        {
            content.Add(item);
        }

        public void Output()
        {
            var filename = $"{title}.html";
            using (var sw = new StreamWriter(filename))
            {
                sw.WriteLine(this.MakeHtml());
                Console.WriteLine($"{filename}编写完成");
            }
        }

        public abstract string MakeHtml();
    }
}
